
#include <uart.h>



volatile char ReceivedChar;


ISR (USART_RX_vect)
{

}

void uart_init(void)
{
    /* Tx out PD1 */
	//DDRD |= 0b00000010;
	DDRD |= (1<< DDD1);
    /* Rx in  PD0 */
	//DDRD &=~0b00000001;
    DDRD &=~(1<< DDD0);

    /*Set baud rate */
    UBRR0H = (MYUBRR) >> 8;
    UBRR0L = MYUBRR;
    
    UCSR0B |= (1 << RXEN0) | (1 << TXEN0);      // Enable receiver and transmitter
  //  UCSR0B |= (1 << RXCIE0);                    // Enable receiver interrupt
    UCSR0C |= (1 << UCSZ01) | (1 << UCSZ00);    // Set frame: 8data, 1 stop
}

void uart_tx(char byte_to_send)
{
	/* Wait until the port is ready to be written to. */
	while( ( UCSR0A & ( 1 << UDRE0 ) ) == 0 )
	{
	
	}
 	/* Write the byte to the serial port. */
	UDR0 = byte_to_send;
}


void send_to_terminal(char byte_to_send)
{
	uart_tx(byte_to_send);
	uart_tx(0x0A);
	uart_tx(0x0D);
}

